/**
 * 
 */
package qy.jalgotrade.utils.resamplebase;

import java.time.ZonedDateTime;

/**
 * @author qy
 *
 */
public class DayRange extends TimeRange {

	private ZonedDateTime __begin;

	private ZonedDateTime __end;

	/**
	 * 
	 * @param dateTime
	 */
	public DayRange(ZonedDateTime dateTime) {

		super();
		__begin = ZonedDateTime.of(dateTime.toLocalDate(), DAY_TRADE_BEGIN_TIME, dateTime.getZone());
		__end = __begin.plusDays(1);
	}

	/*
	 * (non-Javadoc)
	 * @see qy.jalgotrade.utils.resamplebase.TimeRange#belongs(java.time.ZonedDateTime)
	 */
	@Override
	public boolean belongs(ZonedDateTime dateTime) {

		return (dateTime.isEqual(__begin) || dateTime.isAfter(__begin)) && dateTime.isBefore(__end);
	}

	/*
	 * (non-Javadoc)
	 * @see qy.jalgotrade.utils.resamplebase.TimeRange#getBeginning()
	 */
	@Override
	public ZonedDateTime getBeginning() {

		return __begin;
	}

	/*
	 * (non-Javadoc)
	 * @see qy.jalgotrade.utils.resamplebase.TimeRange#getEnding()
	 */
	@Override
	public ZonedDateTime getEnding() {

		return __end;
	}
}
